<view class="main">
    <view class="top">
        <view class="userInformation">
            <view class="userShadow">
                <open-data type="userAvatarUrl" class="userIcon"></open-data>
            </view>
            <view class="userName">
                <view class="name">游戏名: {{userName}}</view>
            </view>
        </view>
    </view>
    <view class="bottom">
        <view class="title">服务工具</view>
        <van-grid border='{{false}}'>
            <van-grid-item icon="/src/announcement.png" text="新手公告" bind:click='announcement' />
            <van-grid-item icon="/src/leave.png" text="申请请假" bind:click='vacate'/>
            <van-grid-item icon="/src/delete.png" text="删除成员" bind:click='deletemember' qq:if='{{admin}}'/>
            <van-grid-item icon="/src/userDel.png" text="删号跑路" bind:click='userDel'/>
            <van-grid-item icon="/src/print.png" text="战报打印" bind:click='exportExcel'  qq:if='{{admin}}' />
            <van-grid-item icon="/src/act.png" text="设置行动"  bind:click='act' qq:if='{{admin}}'/>
            <van-grid-item icon="/src/rename.png" text="修改名字" bind:click='rename'/>
            <van-grid-item icon="/src/recover.png" text="恢复成员" bind:click='recover' qq:if='{{admin}}'/>
            <van-grid-item icon="/src/set.png" text="设置密钥" bind:click='setKey' qq:if='{{admin}}'/>
            <van-grid-item icon="/src/retroactive.png" text="签到补录" bind:click='retroactive' qq:if='{{admin}}'/>
            <van-grid-item icon="/src/onHook.png" text="挂机判定" bind:click='onHook' qq:if='{{admin}}'/>
            <!-- <van-grid-item icon="/src/group.png" text="成员分组" bind:click='group' qq:if='{{admin}}'/> -->
            <van-grid-item icon="/src/deleteAct.png" text="删除行动" bind:click='deleteAct' qq:if='{{admin}}'/>
            <!--<van-grid-item icon="/src/sprog.png" text="萌新创建" bind:click='sprog' qq:if='{{admin}}'/> -->
            <van-grid-item icon="/src/errorSign.png" text="错误补录" bind:click='errorSign' qq:if='{{admin}}'/>
            <van-grid-item icon="/src/managePrivilege.png" text="管理权限" bind:click='managePrivilege' qq:if='{{admin}}'/>
            <van-grid-item icon="/src/empty.png" text="赛季清空" bind:click='empty' qq:if='{{admin}}'/>
            <van-grid-item icon="/src/userSwitch.png" text="成员转盟" bind:click='userSwitch' qq:if='{{admin}}'/>
            <van-grid-item icon="/src/switch.png" text="联盟切换" bind:click='switchAlliance' qq:if='{{admin}}'/>
        </van-grid>
    </view>
    <van-dialog id="van-dialog" />
    <van-dialog
        use-slot
        show="{{show}}"
        showConfirmButton='{{false}}'
        zIndex="{{0}}"
    >
    <van-cell-group>
            <van-field
                value="{{ newUserName }}"
                placeholder="请输入用户名"
                border="{{ false }}"
                label="新用户名"
                bind:change="onChange"
                error-message="用户名不能为空"
            />
            <view class='buttonGroup'>
                <van-button type="default" size='large' class="button" square bind:click='onClose' >取消</van-button>
                <van-button type="default" size='large' class="button" square bind:click='comfirm' >确认</van-button>
            </view>
        </van-cell-group>
    </van-dialog>
    <van-dialog
        use-slot
        show="{{showKey}}"
        showConfirmButton='{{false}}'
        zIndex="{{0}}"
    >
    <van-cell-group>
            <van-field
                value="{{ oldKey }}"
                placeholder="请输入旧密钥"
                border="{{ false }}"
                label="旧密钥"
                bind:change="onChangeKey"
                data-key="old"
            />
            <van-field
                value="{{ newKey }}"
                placeholder="请输入新密钥"
                border="{{ false }}"
                label="新密钥"
                bind:change="onChangeKey"
                error-message="新旧密钥都不能为空"
                data-key="new"
            />
            <view class='buttonGroup'>
                <van-button type="default" size='large' class="button" square bind:click='onCloseKey' >取消</van-button>
                <van-button type="default" size='large' class="button" square bind:click='comfirmKey' >确认</van-button>
            </view>
        </van-cell-group>
    </van-dialog>
    <van-toast id="van-toast" zIndex="{{3000}}"/>
    <van-popup show="{{ showAct }}" position='bottom'>
        <van-nav-bar
            title="联盟列表"
            left-text="返回"
            right-text="确认"
            left-arrow
            bind:click-left="onClickLeft"
            bind:click-right="onClickRight"
        />
        <van-picker columns="{{ columns }}" bind:change="onChangeAlliance"  class="picker" />
    </van-popup>
    <van-cell  is-link bind:click="announcement" />
    <van-popup show="{{ announcementShow }}" >
        <div class="context">
            <div class="title">新手须知</div>
            <div>1、小程序名字要与游戏名字相同</div>
            <div>2、照片上传请用战报截图,截图里要有自己名字以及自家联盟名</div>
            <div>3、增援也要发增援战报进行上传,管理后期审核</div>
            <div>4、到场了但没交战记录,请找管理说明</div>
            <div>5、战报识别错误是正常现象,管理后期审核,无须找管理</div>
            <div>6、如有事,请在小程序上面请假</div>
            <van-button type="primary" class="confirm" bind:click="announcementClose" custom-class='padding: 0 50px'>确认</van-button>
        </div>
    </van-popup>
</view>
